package com.demo;

import com.demo.animal.Cat;
import com.demo.animal.Dog;
import com.spring.ApplicationContext;

import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.List;

/**
 * @author chengjy
 * @date 2025/4/7
 */
class Main {
    public static void main(String[] args) throws IOException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        Dog dog = new Dog(new Cat(null));
        System.out.println(dog);
        Constructor constructor = Dog.class.getConstructors()[0];
        Object object = constructor.newInstance(null);
        System.out.println("==============");

        ApplicationContext applicationContext = new ApplicationContext("com.demo");
        List<MyAnimal> beans = applicationContext.getBeans(MyAnimal.class);

        System.out.println("开始打印程序");
        System.out.println(beans);

        Dog myDog = applicationContext.getBean(Dog.class);

    }
}
